import request from '@/router/axios';
import {baseUrl} from '@/config/env';



export const loginByUsername = (tenantId, username, password, type) =>
  request({
    url: '/api/blade-auth/oauth/token',
    method: 'post',
    headers: {
      'Tenant-Id': tenantId
    },
    params: {
      tenantId,
      username,
      password,
      grant_type: "password",
      scope: "all",
      type
    }
  })

export const refreshToken = (refresh_token) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  params: {
    refresh_token,
    grant_type: "refresh_token",
    scope: "all",
  }
})

export const getButtons = () => request({
  url: '/api/blade-system/menu/buttons',
  method: 'get'
});

export const getUserInfo = () => request({
  url: baseUrl + '/user/getUserInfo',
  method: 'get'
});

export const sendLogs = (list) => request({
  url: baseUrl + '/user/logout',
  method: 'post',
  data: list
})

export const logout = () => request({
  url: baseUrl + '/user/logout',
  method: 'get'
})

export const getProList = () => request({
  url: baseUrl + '/product',
  method: 'get'
})
export const getFile = () => request({
  url: baseUrl + '/user/getFileData',
  method: 'get'
})

export const journalList = (current, size, createBy, tenantId) => request({
  url: '/api/blade-log/api/list',
  method: 'get',
  params: {
    current,
    size,
    createBy,
    tenantId
  }
})

export const systemOrrerJournal = (current, size, serviceId, createBy, tenantId, methodName) => request({
  url: '/api/blade-log/error/list',
  method: 'get',
  params: {
    current,
    size,
    serviceId,
    createBy,
    tenantId,
    methodName
  }
})

export const usualOrrerJournal = (current, size, serviceId, createBy, tenantId) => request({
  url: '/api/blade-log/usual/list',
  method: 'get',
  params: {
    current,
    size,
    serviceId,
    createBy,
    tenantId
  }
})




